<?php
/**
 * Created by PhpStorm.
 * User: clcw908
 * Date: 2017/4/20
 * Time: 17:18
 */
//把redis 中，其他库中的数据，全部移动到0库中
date_default_timezone_set("Asia/Shanghai");
set_time_limit(0);
if (isset($_SERVER['REQUEST_URI'])) {
    die('error');
}

if (!defined('API_ROOT_PATH')) {
    define('API_ROOT_PATH', dirname(dirname(__FILE__)));
}

require_once (API_ROOT_PATH . '/inc/Config.php');

$redis = new Redis();
$redis->connect(REDIS_HOST,REDIS_PORT);
$dbArr = [1,2,4];
foreach ($dbArr as $key=>$value){
    $redis->select($value);
    $allKeys = $redis->keys('*');
    //echo "当前Redis库是:".$value."\r\n";
    foreach($allKeys as $k => $val){
        echo $val."\r\n";
        $redis->move($val,0);//把所有redis库中的键，全部移动到0库中
    }
}


